import api from "../../utils/api";
Component({
  data: {
    imgLoad:false,
    item:{}
  },  
  properties: {
    item:{
      type:Object,
      value:{},
      observer: function(newVal, oldVal) {
        if(newVal){
          newVal.titleImg = api.cosHttp + newVal.titleImg ;
          newVal.created = this.setTimeFormat(newVal.created);
          this.setData({ item:newVal })
        }
      }      
    }
  },
  attached(){},
  methods: {
    setTimeFormat(val){
      var paddingStr = function (_str) {
        return _str.length == 1 ? "0" + _str : _str
      }
      var _curDate = new Date(val);	
      var _YY = _curDate.getFullYear();
      var _MM = paddingStr(_curDate.getMonth() + 1 + '');
      var _DD = paddingStr(_curDate.getDate() + '');
      return `${_YY}-${_MM}-${_DD}`					
    },
    imgLoadFn(){
      this.setData({ imgLoad:true })
      
    }
  }
})
